var api = require('../../utils/api.js')

Page({

  /**
   * 页面的初始数据
   */
  data: {
    list:[],
    page:1
  },

  onLoad(options) {

  },

  nexturl(ret){
    console.log(ret);
    var url=ret.currentTarget.dataset.url;

    wx.navigateTo({
      url: url
    })

  },

  onShow() {
    this.getmyorder();
  },

  getmyorder(){
    var that=this;
    var page=this.data.page;
    var lists=this.data.list;


    api.get({
      url: 'wxapp/user/getmyorder',
      data: {page:page},
      success: data => {
          var list=data.data;

        if(list.length>0){

          list.forEach(function (index) {
              console.log(index);
              lists.push(index);

          })

          that.setData({
            list:lists,
            page:page+1
          })

        }

      }
  });

  }
})